<template>
	<div>
		<DetailPage v-bind="ExtendFormConfig" :model="formMode" style="width: 98%; margin: 0 auto">
			<template v-slot:dpServiceOrgHonors="{ row }">
				<ApldTable :columns="row.column" :data="formMode.dpServiceOrgHonorList"></ApldTable>
			</template>
		</DetailPage>
	</div>
</template>

<script setup lang="ts">
import { ApldTable } from '@/components/AplidCrud'
import DetailPage from '@/views/aplid/DetailPage/index.vue'
import apiMod from '@/apiMod'
import { ExtendFormConfig } from '../../config'
import { useCommonStore } from '@/stores/common'

const props = defineProps({
	chainViewInfo:{
		type:Object,
		default:()=>({})
	},
	isBlockchain:{
		type:Boolean,
		default:false
	}
})

const { setLoading } = useCommonStore()
const nowRowData: any = inject('nowRowData')
const formMode:any = ref({
	dpServiceOrgHonorList: [],
})
const getInitData = () => {
	setLoading()
	apiMod.dpServiceOrgHome_detail(nowRowData.id).then((res) => {
		formMode.value = {
			...res.data,
		}
		setLoading()
	})
}

onMounted(() => {
	if(props.isBlockchain){
		formMode.value = props.chainViewInfo
		formMode.value.dpServiceOrgHonorList = props.chainViewInfo.bcServiceOrgHonor?JSON.parse( props.chainViewInfo.bcServiceOrgHonor):[]
	}else{
		getInitData()
	}
})
</script>

<style scoped></style>
